package com.uzai.common.enums;

/**
 * @Auther: xiaoyuexl
 * @Date: 2022/1/20 16:13
 * @Description:
 */
public enum JsonMessageEnum {
    JMT_UNKNOWN(0,"未知类型"),
    JMT_CQERCODE(1,"查券二维码海报"); //数据格式：{"platform":PlatformTypeEnum,"title":"标题","imageurl":"图片连接","url":"购买连接","price":10.00,"fanli":1.6,"coupon":5,"buyprice":5}

    private Integer value;
    private String desc;

    JsonMessageEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static JsonMessageEnum getById(Integer id) {
        if (id == null) {
            return null;
        }
        for (JsonMessageEnum type: JsonMessageEnum.values()) {
            if (type.getValue().intValue() == id) {
                return type;
            }
        }
        return null;
    }
}
